package com.lan.script;

import com.lan.model.Symbol;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public abstract class ScriptOt {

    protected Map<Symbol, Object> metadata = new TreeMap<>();

    public Map<Symbol, Object> getMetadata() {
        return this.metadata;
    }

    public ScriptOt add(final Symbol key, final Object value) {
        if (this.metadata.isEmpty()) {
            this.metadata = new HashMap<>();
        }
        this.metadata.put(key, value);
        return this;
    }

    public Object get(final Symbol key) {
        return this.metadata.get(key);
    }

    public ScriptOt del(final Symbol key) {
        this.metadata.remove(key);
        return this;
    }

}
